home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 957 < prev    next >
Encoding:
Text File  |  1996-08-06  |  1.9 KB  |  78 lines

  1. Path: fido.asd.sgi.com!austern
  2. From: Michael Klobe <mklobe@objectspace.com>
  3. Newsgroups: comp.std.c++
  4. Subject: stack template argument question
  5. Date: 03 Apr 1996 16:48:06 PST
  6. Organization: -
  7. Approved: austern@isolde.mti.sgi.com
  8. Message-ID: <pgpmoose.199604031648.8414@isolde.mti.sgi.com>
  9. NNTP-Posting-Host: isolde.mti.sgi.com
  10. X-Original-Date: Wed, 3 Apr 96 18:47:43 CST
  11. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  12.     iQBVAwUBMWMcR0y4NqrwXLNJAQHg1AH/X2pTywwAE2juMfpIUQSot7fTOidvweO0
  13.     E3vld2hwZyjXnp54k5nDi7HLM++SgYoQOXxuZfkfiNpz7xVyBqcLgQ==
  14.     =dEGT
  15. Originator: austern@isolde.mti.sgi.com
  16.  
  17. The definition of stack as I understand it is this:
  18.  
  19. namespace std
  20.   {
  21.   template
  22.     < 
  23.     class T, 
  24.     class Container = deque< T >, 
  25.     class Allocator = allocator 
  26.     >
  27.   class stack;
  28.   }
  29.  
  30. Given this, for what is the Allocator parameter used?  It won't be a
  31. part of the Container type, and stack itself doesn't make any use of
  32. Allocators.  The other sequence adapters (adaptors?) have the same
  33. semantics.  It seems like what you would really want is something 
  34. like this:
  35.  
  36. namespace std
  37.   {
  38.   template
  39.     < 
  40.     class T, 
  41.     class Allocator = allocator,
  42.     class Container = deque< T, Allocator >
  43.     >
  44.   class stack;
  45.   }
  46.  
  47. or even:
  48.  
  49. namespace std
  50.   {
  51.   template
  52.     < 
  53.     class T, 
  54.     class Container = deque< T >
  55.     >
  56.   class stack
  57.     {
  58.     public:
  59.       // ... lots of definitions
  60.       typedef Container::allocator_type allocator_type;
  61.     };
  62.   }
  63.  
  64. What am I missing?
  65.  
  66. -mck
  67.    _      
  68.  _| ~~.  Michael Klobe
  69.  \,  _}  mklobe@objectspace.com
  70.    \(    Texas Fight!
  71. ---
  72. [ comp.std.c++ is moderated.  To submit articles: Try just posting with your 
  73.                 newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  74.   comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  75.   Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  76.   Comments? mailto:std-c++-request@ncar.ucar.edu 
  77. ]
  78.